<script src="${ctx}/extends/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${ctx}/workflowStatic/js/javacode/codemirror.js"></script>
<script type="text/javascript" src="${ctx}/workflowStatic/js/javacode/InitMirror.js"></script>
<script type="text/javascript" src="${ctx}/workflowStatic/js/commonScript.js"></script>
<script type="text/javascript" src="${ctx}/workflowStatic/js/flowVars.js"></script>
<link href="${ctx}/workflowStatic/style/css/workflow.css" rel="stylesheet">


<!--<form " action="" lay-filter="varItem" >-->
<form id="bpmNodeScriptForm" class="layui-form " style="margin: 10px">
    <div >
        <textarea class="windowName" style="display: none;">${windowName}</textarea>
        <span class="commonScript" style="cursor: pointer;">
            <i class="layui-icon layui-icon-fonts-code"></i>常用脚本
        </span>
        &nbsp;表单变量:
        <div style="width: 150px;display: inline-block;">
            <select name="flowVars" class="flowVars" >
                <option value="">请选择</option>
            </select>
        </div>
    </div>
    <div class="layui-form-text">
        <li class="layui-this">表达式必须返回Set 集合类型的数据,数据项为用户ID</li>
    </div>
    <div class="layui-input-inline" >
        <textarea id="typeScript"  name="script" codemirror="true" mirrorheight="200px" >
        </textarea>
    </div>
    <div>
        <input type="hidden" id="nodeId" name="nodeId" value="${nodeId}" />
        <input type="hidden" id="procDefId" name="procDefId" value="${procDefId}"/>
        <input type="hidden" id="modelId" name="modelId" value="${modelId}"/>
        <input type="hidden" id="parentProcDefId" name="parentProcDefId" value="${parentProcDefId}"/>
    </div>
</form>
<!--<div class="layui-btn-container" style="text-align: center;position: absolute;bottom: 15px;left: 0px;right: 0px;">-->
    <!--<button class="layui-btn" lay-submit lay-filter="varForm" id="save">保存</button>-->
    <!--<button class="layui-btn layui-btn-danger" id="close">关闭</button>-->
<!--</div>-->
<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','form', 'layer'], function () {
        var layer = layui.layer;
        var form = layui.form;
        var $ = layui.$;
        //获取前弹窗文本域的值
        $('#typeScript').html($(".thisWindowButton").siblings(".hiddenJson").text());
        form.render('select'); //刷新select选择框渲染
        //保存
        $(document).on('click', '#save', function () {
            //获取本弹窗添加的值
            InitMirror.editor.save();
            var data = $('#typeScript').val();
            //对前弹窗文本域赋值
            $(".textarea").html(data);
            $(".hiddenJson").html(data);
            //关闭弹窗
            layer.close(layer.index);
            return false;
        });
        //取消
        $(document).on('click', '#close', function () {
            layer.close(layer.index);
        });
    })
</script>
